<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="../script/jquery-1.10.min.js"></script>
    <link rel="stylesheet" href="../script/bootstrap-3.3.7.min.css">
    <style>

    </style>
</head>

<body>


<div class="container">
    <div class="row" style="margin: 10px">
        <div class="col-md-8">
            <table>
                <tbody>

                </tbody>
            </table>

        </div>
    </div>
</div>
<script>
    var html = "<tr style='width: 100%'><td style='background-color: #cccccc;width: 100px'>dd</td><td style='width: 100px' class='btn btn-success' data-target=''>删除前一个li</td><td>第三列</td></tr>"
    //    添加5个li
    for (var i = 0; i < 5; i++) {
//        console.log(html)
        $("table tbody").append(html)
    }

    $("table tr div:first").click(function () {
        var t = $(this);
//        console.log(this, this.innerHTML);
//        console.log(t.attr("style"));
//        console.log(t.css("background-color"));
        var lifather = t.parent();
//        console.log(lifather.text())
    });
    //给每个li 添加事件,删除自己并删除前一个元素li
    $(".btn").click(function () {
        var t = $(this)
//        console.log(t.prev())
        t.prev().remove()
        t.remove()
    })

   $("tbody tr:odd").css("background-color","red")

</script>
</body>
</html>